{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. Install Kotlin Jupyter for Local Testing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting kotlin-jupyter-kernel\n",
      "  Downloading kotlin_jupyter_kernel-0.11.0.255-py3-none-any.whl (78.2 MB)\n",
      "\u001B[2K     \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m78.2/78.2 MB\u001B[0m \u001B[31m1.3 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m00:01\u001B[0m00:02\u001B[0m\n",
      "\u001B[?25hInstalling collected packages: kotlin-jupyter-kernel\n",
      "Successfully installed kotlin-jupyter-kernel-0.11.0.255\n"
     ]
    }
   ],
   "source": [
    "!pip install kotlin-jupyter-kernel"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Switch Kernel\n",
    "\n",
    "Reconnect to Kernel and select `Kotlin` Kernel"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. Test Kotlin Jupyter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{\"x\":2,\"y\":3}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import kotlinx.serialization.*\n",
    "import kotlinx.serialization.json.*\n",
    "\n",
    "\n",
    "@Serializable\n",
    "data class Pt(val x: Int, val y: Int)\n",
    "\n",
    "\n",
    "Json.encodeToString(Pt(2, 3))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "source": [
    "# 4. Make your testing!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "@file:DependsOn(\"org.springframework.boot:spring-boot-starter-web:2.7.9\")\n",
    "\n",
    "import org.springframework.boot.autoconfigure.SpringBootApplication\n",
    "import org.springframework.boot.runApplication\n",
    "import org.springframework.stereotype.Controller\n",
    "import org.springframework.web.bind.annotation.GetMapping\n",
    "import org.springframework.web.bind.annotation.RequestMapping\n",
    "\n",
    "@Controller\n",
    "@RequestMapping(\"\")\n",
    "class HelloController {\n",
    "    @GetMapping(\"/hello\")\n",
    "    fun helloKotlin(): String {\n",
    "        return \"hello world\"\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "@file:DependsOn(\"org.springframework.boot:spring-boot-starter-web:2.7.9\")\n",
    "\n",
    "import org.springframework.boot.autoconfigure.SpringBootApplication\n",
    "import org.springframework.boot.runApplication\n",
    "import org.springframework.stereotype.Controller\n",
    "import org.springframework.web.bind.annotation.GetMapping\n",
    "import org.springframework.web.bind.annotation.RequestMapping\n",
    "\n",
    "@SpringBootApplication\n",
    "class ChatreplApplication\n",
    "\n",
    "fun main(args: Array<String>) {\n",
    "    val application = runApplication<ChatreplApplication>(*args)\n",
    "}\n",
    "\n",
    "main(arrayOf(\"--server.port=8083\"))"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.8.20-Beta"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
